#include "texture_storage.hpp"

namespace sdl_engine {

Texture* TextureStorage::Load(const std::string& filename) {
    return Load(filename, filename);
}

Texture* TextureStorage::Load(const std::string& filename, const std::string& name) {
    Texture* texture = new Texture(filename);
    datas_[name].reset(texture);
    return texture;
}

Texture* TextureStorage::Get(const std::string& name) {
    auto it = datas_.find(name);
    if (it == datas_.end())
        return nullptr;
    return it->second.get();
}

}
